﻿Public Class clsReasonMst
    Public Function getReason(product As String, procedure_no As String) As DataTable
        Dim szSql As String = ""
        szSql &= "select * from sf.t_mst_reason "
        szSql &= " where factory_id= ? and workshop = ? and product = ? and procedure_No = ?"
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", "1", product, procedure_no)
        If IsNothing(dt) Then
            getReason = New DataTable
        Else
            getReason = dt
        End If
    End Function

    Public Sub setMstChkList(chl As DevExpress.XtraEditors.CheckedListBoxControl,
                             product As String,
                             procedure_no As String)
        Dim dt As DataTable = getReason(product, procedure_no)
        If dt.Rows.Count > 0 Then
            For i As Integer = 0 To dt.Rows.Count - 1
                chl.Items.Add(dt.Rows(i)("reason"))
            Next
        End If
    End Sub

End Class
